package com.yhsoft.bill.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yhsoft.bill.controller.request.SysYckLogInVo;
import com.yhsoft.bill.controller.request.VenderYszkMxInVo;
import com.yhsoft.bill.controller.response.SysCzMxOutVo;
import com.yhsoft.bill.controller.response.SysXhLogOutVo;
import com.yhsoft.bill.controller.response.VenderCwtjOutVo;
import com.yhsoft.bill.service.ISysYfzkService;
import com.yhsoft.bill.service.IVenderYszkMxService;
import com.yhsoft.common.response.PageResult;
import com.yhsoft.common.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 供货商应收账款 前端控制器
 * </p>
 *
 * @author yyyyyyyh
 * @since 2023-11-03
 */
@Api(tags = {"H-财务统计-供货商应收账款"})
@RestController
@RequestMapping("/bill/venderYszk")
public class VenderYszkMxController {

    @Resource
    private IVenderYszkMxService iVenderYszkMxService;

    @Resource
    private ISysYfzkService iSysYfzkService;

    @ApiOperation("应收账款列表")
    @GetMapping("/getYsMx")
    public Result<PageResult<SysCzMxOutVo>> getCzMx(VenderYszkMxInVo inVo,
                                                    @RequestParam(value = "pageNo") Long pageNo,
                                                    @RequestParam(value = "pageSize") Long pageSize) {
        IPage<SysCzMxOutVo> iPage = iVenderYszkMxService.getYsMx(inVo, pageNo, pageSize);
        return Result.success(PageResult.valueOf(iPage));
    }

    @ApiOperation("应收账款明细(消耗日志)")
    @GetMapping("/getXhLog")
    public Result<PageResult<SysXhLogOutVo>> getXhLog(SysYckLogInVo inVo,
                                                      @RequestParam(value = "pageNo") Long pageNo,
                                                      @RequestParam(value = "pageSize") Long pageSize) {
        IPage<SysXhLogOutVo> iPage = iVenderYszkMxService.getXhLog(inVo, pageNo, pageSize);
        return Result.success(PageResult.valueOf(iPage));
    }

    @ApiOperation("财务统计")
    @GetMapping("/cwtj")
    public Result<VenderCwtjOutVo> cwtj() {
        VenderCwtjOutVo outVo = iSysYfzkService.cwtj();
        return Result.success(outVo);
    }
}
